import java.util.LinkedHashSet;
import java.util.Set;


public class P64 {
	public static void main(String[] args) {
		int count = 0;
		for (int i = 2; i <= 10000; i++) {
			
			boolean isSquare = false;
			
			for (int j = 1; j < i; j++) {
				if (j * j == i) {
					isSquare = true;
					break;
				} if (j * j > i) {
					break;
				}
			}
			
			if (isSquare) {
				continue;
			}
			
			Num num = new P64.Num();
			num.n = i;
			num.numerator[0] = 1;
			num.numerator[1] = -1 * (int) Math.sqrt(num.n);
			num.denominator[0] = 0;
			num.denominator[1] = 1;		
			
			
			Set<Num> numSet = new LinkedHashSet<Num>();
			
			while (true) {
				num = reverse(num);
				num = cal(num);			
				//print(num);
				
				if (numSet.contains(num)) {
					break;
				}
				numSet.add(num);
			}
			
			if (numSet.size()%2 == 1) {
				count++;
			}
			System.out.println(i);
		}
		
		System.out.println(">>>" + count);
	}
	
	public static Num cal(Num num) {
		Num newNum = new Num();
		newNum.n = num.n;
		newNum.denominator[0] = 0;
		newNum.denominator[1] = num.n - num.denominator[1] * num.denominator[1];
		newNum.denominator[1] /= num.numerator[1];
		
		
		newNum.numerator[0] = 1;
		newNum.numerator[1] = -1 * num.denominator[1];
		
		int max = (int) Math.sqrt(newNum.n);
		//System.out.println(max);
		while (newNum.numerator[1] - newNum.denominator[1] >= -1 *max) {
			newNum.numerator[1] -= newNum.denominator[1];
			newNum.a++;
		}
		
		return newNum;
	}
	
	public static Num reverse(Num num) {
		Num newNum = new Num();
		newNum.n = num.n;
		newNum.numerator = num.denominator;
		newNum.denominator = num.numerator;		
		return newNum;
	}
	
	public static String notation(int[] x, int n) {
		StringBuffer buffer = new StringBuffer();
		buffer.append("( ");
		if (x[0] != 0) {
			buffer.append("root(" + n + ") ");
		}
		
		if (x[1] > 0) {
			if (x[0] != 0) {
				buffer.append(" + ");	
			}
			buffer.append(x[1]);
		} else if (x[1] < 0) {
			if (buffer.length() > 0) {
				buffer.append(" - ");	
			} else {
				buffer.append("-");
			}
			buffer.append(-1 * x[1]);	
		}
		buffer.append(" )");
		
		return buffer.toString();
	}
	
	public static void print(Num num) {
		String n = notation(num.numerator, num.n);
		String d = notation(num.denominator, num.n);
		
		if (num.a != 0) {
			System.out.print(num.a + " + ");
		}
		
		System.out.print(n);	
		
		System.out.print("/");
		System.out.print(d);
		System.out.println();
	}
	
	public static class Num {
		int[] numerator = new int[2];
		int[] denominator = new int[2];
		int a = 0;
		int n = 0;
		
		@Override
		public boolean equals(Object obj) {
			Num x = (Num) obj;
			return n == x.n &&
					numerator[0] == x.numerator[0] &&
					numerator[1] == x.numerator[1] &&
					denominator[0] == x.denominator[0] &&
					denominator[1] == x.denominator[1] &&
					a == x.a;
		}
		
		@Override
		public int hashCode() {
			StringBuffer buffer = new StringBuffer();
			buffer.append(n);
			buffer.append(",");
			buffer.append(a);
			buffer.append(",");
			buffer.append(numerator[0]);
			buffer.append(",");
			buffer.append(numerator[1]);
			buffer.append(",");
			buffer.append(denominator[0]);
			buffer.append(",");
			buffer.append(denominator[1]);
			return buffer.toString().hashCode();
		}
	}
}

